﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OutLook.Properties.Calc.Structures
{
    public class Oxide
    {

        #region Methods

        public void SetCationAndAnionWeight(double value)
        {
            CationWeight = (value * CationCoefficient) / GetWeight();
            AnionWeight = (value * AnionCoefficient) / GetWeight();
        }

        public void SetCationAndAnionAverageWeight(double kationSumm, double anionSumm)
        {
            CationAverageWeight = CationWeight / kationSumm;
            AnionAverageWeight = AnionWeight / anionSumm;
        }

        private double GetWeight()
        {
            return CationFeature.Mass * CationCoefficient + AnionFeature.Mass * AnionCoefficient;
        }



        #endregion

        #region Properties

        /// <summary>
        /// Name of cation
        /// </summary>
        public string CationName { get; set; }

        /// <summary>
        /// Name of anion
        /// </summary>
        public string AnionName { get; set; }

        /// <summary>
        /// Coefficient of cation
        /// </summary>
        public int CationCoefficient { get; set; }

        /// <summary>
        /// Coefficient of anion
        /// </summary>
        public int AnionCoefficient { get; set; }

        /// <summary>
        /// Cation features
        /// </summary>
        public Element CationFeature { get; set; }

        /// <summary>
        /// Anion features
        /// </summary>
        public Element AnionFeature { get; set; }

        /// <summary>
        /// Cation weight
        /// </summary>
        public double CationWeight { get; set; }

        /// <summary>
        /// Anion weight
        /// </summary>
        public double AnionWeight { get; set; }

        /// <summary>
        /// Cation average weight
        /// </summary>
        public double CationAverageWeight { get; set; }

        /// <summary>
        /// Anion average weight
        /// </summary>
        public double AnionAverageWeight { get; set; }

        #endregion
    }
}
